package com.bianmaba.spring.data.jpa.configure;

import com.bianmaba.spring.data.jpa.repository.support.ExtendedRepositoryImpl;
import org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension;
import org.springframework.data.repository.config.RepositoryConfigurationExtension;

import java.lang.annotation.Annotation;

/**
 * @program: bianmaba-web-framework-extends
 * @description:
 * @author: Chenjiabin
 * @create: 2018-04-22 20:29
 **/
class BianmabaJpaRepositoriesAutoConfigureRegistrar extends AbstractRepositoryConfigurationSourceSupport {
    BianmabaJpaRepositoriesAutoConfigureRegistrar() {
    }

    protected Class<? extends Annotation> getAnnotation() {
        return EnableJpaRepositories.class;
    }

    protected Class<?> getConfiguration() {
        return BianmabaJpaRepositoriesAutoConfigureRegistrar.EnableJpaRepositoriesConfiguration.class;
    }

    protected RepositoryConfigurationExtension getRepositoryConfigurationExtension() {
        return new JpaRepositoryConfigExtension();
    }

    @EnableJpaRepositories(repositoryBaseClass = ExtendedRepositoryImpl.class)
    private static class EnableJpaRepositoriesConfiguration {
        private EnableJpaRepositoriesConfiguration() {
        }
    }
}
